package org.dwell.vertx3.demos.core;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;

/**
 * Created by JianGuo on 2016/1/14.
 */
public class PeriodicAndDelayVerticle extends AbstractVerticle {

    public static void main(String[] args) {
        Vertx vertx = Vertx.vertx();
        //返回一个唯一的定时器ID，这个ID可以用来取消一个定时器
        long timerID = vertx.setTimer(1000, id -> {
            System.out.println("one shot timer is called!");
        });

        vertx.cancelTimer(timerID);
        System.out.println("first this is printed!");
    }

    @Override
    public void start() throws Exception {

    }

}
